import { $ } from './library/jquery-module.js';
import { cookie } from './library/cookie.js';

let timer;
clearTimeout(timer);
var typeNumber = window.location.search.replace("?type=", "");
// console.log(typeNumber);
switch (typeNumber) {
    case '1':
        loadType($('.tips'), '登陆成功，正在进入首页 ...', "./index.html", 1000);
        break;
    case '2':
        loadType($('.tips'), '您的用户名或密码错误，请重新输入 ...', "./login.html", 1500);
        break;
    case '3':
        loadType($('.tips'), '注册成功，正在跳转到登录页 ...', "./login.html", 1000);
        break;
    case '4':
        loadType($('.tips'), '没有检测到登陆的用户，请登录 ...', "./login.html", 1500);
        break;
    case '5':
        loadType($('.tips'), '修改密码成功，请重新登陆 ...', "./login.html", 1500);
        break;
    case '6':
        loadType($('.tips'), '检测到存在已登陆的用户，前往首页 ...', "./index.html", 1000);
        break;

}

function loadType(node, word, url, delay, callback) {
    node.html(word);
    timer = setTimeout(function() {
        callback ? callback() : null;
        location.href = url;
    }, delay)
}